<%@ page language="java" pageEncoding="utf-8" %>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@taglib prefix="m" uri="/cutm_tags"%>
<html>
<head>
<title>参数管理</title>
<meta http-equiv="cache-control" content="no-cache"> 
<script type="text/javascript">
$(document).ready(function(){
	$('input[name=enums.disable]').radio('false');
	$('#enmuForm').vaildAjax(function(data){
		if(data.charAt(0)=='a'){
			var tr = '<tr id="exp'+data.substring(1)+'"><td><input type="radio" checked="checked" name="opera" value="'+data.substring(1)+'" /></td>';
			$('table.form th').each(function(){
				var listVal = $(this).text();
				tr+='<td>'+getVal('#'+listVal)+'</td>';
			});
			$('input[name="enums.id"]').val(data.substring(1));
			$('table.list').append(tr);
			BaseJs.alert('添加成功');
		}
		if(data.charAt(0)=='u'){
			var tid = data.substring(1);
			var tds = $('#exp'+tid+' td');
			var loop = 1;
			$('table.form th').each(function(){
				var listVal = $(this).text();
				$(tds[loop]).text(getVal('#'+listVal));
				loop++;
			});
			BaseJs.alert('修改成功');
		}
	});
	$('#addNewRole').click(function(){
		$('#enmuForm').resetForm();
		$('input[name="enums.id"]').val('');
		$('input[name=enums.disable]').radio('false');
	});
	$('input[name=opera]').click(function(){
		var tid = $(this).val();
		$('input[name=enums.id]').val(tid);
		$('#exp'+tid+' td').each(function(){
			var lid = $(this).attr('type');
			if(!UtilJs.isEmpty(lid)){
				if(lid=='enums.disable'){
					var boo = $(this).text()=='可使用'?'false':'true';
					$('input[name="enums.disable"]').radio(boo);
				}else if(lid=='enums.supor'){
					var msg = $(this).text();
					if(msg == '一级'){
						$('select[name="enums.supor.id"]').selcByTxt('请选择');	
					}else{
						$('select[name="enums.supor.id"]').selcByTxt(msg);
					}
				}else{
					$('input[name='+lid+']').val($(this).text());
				}
			}
		});
	});
});
function getVal(selc){
	var type = $(selc).attr('type');
	if(type=='text'){
		return $(selc).val();
	}
	if(type=="select-one"){
		var isnull =  $(selc).select()=='';
		return isnull?'一级':$(selc).sltTxt();
	}
	if(type=='radio'){
		if($('input[name="enums.disable"]').radio()=='false'){
			return '可使用';
		}else{
			return '已禁用';
		}
	}
}
</script>
</head>
<body>
<h2 class="title"><span>
<s:if test="enums.type=='channel.type'">频道信息设置</s:if>
<s:elseif test="enums.type=='dept.type'">部门信息维护</s:elseif>
<s:elseif test="enums.type=='manuscript.type'">稿件分类维护</s:elseif>
<s:elseif test="enums.type=='submatter.type'">题材分类维护</s:elseif>
<s:elseif test="enums.type=='manustype.type'">稿件类别维护</s:elseif>
<s:elseif test="enums.type=='start.type'">稿件等级维护</s:elseif>
<s:elseif test="enums.type=='msgFrom.type'">消息来源维护</s:elseif>
<s:elseif test="enums.type=='newsFrom.type'">新闻来源设置</s:elseif>
<s:elseif test="enums.type=='zlstatus.type'">资料状态设置</s:elseif>
<s:elseif test="enums.type=='devices.type'">设备类型维护</s:elseif>
<s:elseif test="enums.type=='broadcastError.errorType'">播出错误类型设置</s:elseif>
<s:elseif test="enums.type=='degree.type'">学历维护</s:elseif>
<s:elseif test="enums.type=='zzmm.type'">政治面貌维护</s:elseif>
</span><m:imgA img="add" msg="添加一条新记录" id="addNewRole"/><m:imgA img="reload" msg="强制刷新本页面" onclick="javascript:BaseJs.reload();" />
</h2>
<s:form id="enmuForm" action="system/EdlitEnums">
	<s:property value="html" escape="false" />
</s:form>
</body>
</html>